const validator = require('validator')

//文章创建验证
module .exports.validateCreateArticle = (title,description,body)=>{
    let err = {}

    if(validator.isEmpty(title)){
        err.title = '文章标题不能为空 !!!'
    }
    if(validator.isEmpty(description)){
        err.description = '文章描述不能为空 !!!'
    }
    if(validator.isEmpty(body)){
        err.body = '文章内容不能为空 !!!'
    }

    let validate = Object.keys(err).length < 1

    return {err,validate}
}
